package com.demo.deal_service.enums;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static java.util.stream.Collectors.toList;

public enum ImageCutEnum {
    DEAL_SMALL_CUT(50, 50, "小尺寸", "DEAL_SMALL", "DEAL_S", "DEAL"),
    DEAL_NORMAL_CUT(100, 100, "普通尺寸", "DEAL_NORMAL", "DEAL_N", "DEAL"),
    DEAL_LARGE_CUT(200, 200, "大尺寸", "DEAL_LARGE", "DEAL_L", "DEAL"),;

    int height;
    int width;
    String module;
    String name;
    String value;
    String suffix;

    ImageCutEnum(int height, int width, String name, String value, String suffix, String module) {
        this.height = height;
        this.width = width;
        this.name = name;
        this.value = value;
        this.suffix = suffix;
        this.module = module;
    }

    public int getHeight() {
        return height;
    }

    public int getWidth() {
        return width;
    }

    public String getName() {
        return name;
    }

    public String getValue() {
        return value;
    }

    public String getSuffix() {
        return suffix;
    }

    public String getModule() {
        return module;
    }

    public static List<ImageCutEnum> getImageCutEnumsByModule(String module) {
        List<ImageCutEnum> list;
        list = Arrays.asList(ImageCutEnum.values());
        return list
                .stream()
                .filter(imageCutEnum -> imageCutEnum.getModule().equals(module))
                .collect(toList());
    }
}
